package com.lanwf.admin.utils;

import org.apache.commons.lang3.StringUtils;

/**
 * @Auther: Lanwf
 * @Date: 2023/3/7 10:38
 * @Description:
 */
public class TestMain {

    /**
     * StringUtils3 各方法的使用
     * @param args
     */
    public static void main(String[] args) {
        s3();
        int a = 0B01100000;
        System.err.println(a);

        int b = 0140;
        System.err.println(b);

        int c = 0x60;
        System.err.println(c);

        isPalindrome(121);

        int i = 2 << 8;
        System.err.println(i);
    }

    public static boolean isPalindrome(int x) {
        if (x == 0) return true;
        if (x < 0 || x % 10 == 0) return false;
        int reversed = 0;
        while (x > reversed) {
            reversed = reversed * 10 + x % 10;
            x /= 10;
        }
        return x == reversed || x == reversed / 10;
    }

    //isBlank ,isNotBlank
    private static void s1(){

        /**
         *      * StringUtils.isBlank(null)      = true
         *      * StringUtils.isBlank("")        = true
         *      * StringUtils.isBlank(" ")       = true
         *      * StringUtils.isBlank("bob")     = false
         *      * StringUtils.isBlank("  bob  ") = false
         */
       ;
        System.err.println(StringUtils.isBlank(null));
        System.err.println(StringUtils.isBlank(""));
        System.err.println(StringUtils.isBlank(" "));

    }

    private static void s2(){

        /**
         * StringUtils.isEmpty(null)      = true
         * StringUtils.isEmpty("")        = true
         * StringUtils.isEmpty(" ")       = false
         * StringUtils.isEmpty("bob")     = false
         * StringUtils.isEmpty("  bob  ") = false
         */
        System.err.println(StringUtils.isEmpty(null));
        System.err.println(StringUtils.isEmpty(""));
        System.err.println(StringUtils.isEmpty(" "));

    }


    private static void s3(){

        /**
         * <pre>
         * StringUtils.abbreviate(null, *)      = null
         * StringUtils.abbreviate("", 4)        = ""
         * StringUtils.abbreviate("abcdefg", 6) = "abc..."
         * StringUtils.abbreviate("abcdefg", 7) = "abcdefg"
         * StringUtils.abbreviate("abcdefg", 8) = "abcdefg"
         * StringUtils.abbreviate("abcdefg", 4) = "a..."
         */

        System.err.println( StringUtils.abbreviateMiddle("abcdefghijklmn", "-",10));

        StringUtils.abbreviate("abcdefg", 6);

    }




}
